package com.cjy.common.utils.tag;

import java.io.Writer;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.TextField;

import com.opensymphony.xwork2.util.ValueStack;

/**
 * 输入框标签bean，自定义标签格式要求 User: Administrator Date: 13-12-14 Time: 上午11:05
 */
public class InputTagBean extends TextField {
	// 是否可见
	private boolean visible;
	private String placeholder;

	public String getPlaceholder() {
		return placeholder;
	}

	public void setPlaceholder(String placeholder) {
		this.placeholder = placeholder;
	}

	public void setVisible(boolean visible) {
		this.visible = visible;
	}

	public InputTagBean(ValueStack stack, HttpServletRequest request,
			HttpServletResponse response) {
		super(stack, request, response);
	}

	@Override
	protected void evaluateExtraParams() {
		super.evaluateExtraParams();
		addParameter("placeholder", findString(placeholder));
	}

	@Override
	public boolean end(Writer writer, String body) {
		if (visible) {
			return super.end(writer, body);
		}
		return false;
	}
}
